Skip to content

Comments

Fix error can't open image files in Python3.#35

Open
youdiandai wants to merge 1 commit intoAstarLight:masterfrom
youdiandai:master
Open

Fix error can't open image files in Python3.#35
youdiandai wants to merge 1 commit intoAstarLight:masterfrom
youdiandai:master

Conversation

@youdiandai
Copy link

1.We tried to use your CRNN network for training, and the Python version we used was 3.7.2,
in the process of generating the LMDB file, I noticed that......an error will occur, Python
3 need to add a "b" flag bit when reading bit type data.
"""
with open(imagePath, 'r') as f:
imageBin = f.read()

"""

  1. I noticed that there was an error when you directly pushed STR into LMDB when I put data
    into LMDB.LMDB should only accept data of bytes type, so we have to encode data asbyte type.

3.In the process of reading data from LMDB, since the data read out is bytes type, the
string operation cannot be carried out directly, and the bytes type decode needs to be
str.

4.The data sets we used is different form yours, so some of the characters in yout
"alphabets.pu"cannot be found and cause application error. I wrote a function to
generate the corresponding "apphabets.py" module according to the data sets wo imprvoe
compatibility.

Add a function to create alphabets.py from dataset
@lironghua318
Copy link

for 3
there is already decode in

  • "train.py", line 55, in val
    list_1.append(i.decode('utf-8','strict'))
  • ''/lib/convert.py", line 43, in encode
    item = item.decode('utf-8', 'strict')

@youdiandai
Copy link
Author

it been a long time since i create this merge.I cant rember it well.send me email if you need to discuss,my email : 1561753947@qq.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants